<!--
	作者：956911785@qq.com
	时间：2019年11月16日23:11:20
	描述：诗词语音-添加
-->

<template>
	<Tcontent ref="Tcontent" :teas="params" :title="title" @addsave="addsave"></Tcontent>
</template>

<script>
	import Tcontent from "./Tcontent";
	export default {
		name:"addscyy",
		props: {
    	},
		data() {
			return {
				params:{
					readid:'', 
					pname:'', 
					author:'', 
					nj:'', 
					bj:'', 
					pcontent:'', 
					fm:'', 
					listsc:[],//诗词内容
					listyy:[],//诗词相关语音
				},
				title:'上传诗词语音'
			}
		},
		components: {
			Tcontent
		},
		methods: {
			addsave:function(datas){
				const da={...datas};
				var bstate="0";
				this.$Modal.confirm({
				    title: '提示',
				    content: '是否发布，如果发布请点击确认',
				    onOk: () => {
				        bstate="1";
						const params={
							pname:da.pname, 
							author:da.author, 
							nj:da.nj, 
							bj:da.bj, 
							pcontent:da.pcontent, 
							fm:da.fm, 
							listsc:JSON.stringify(da.listsc),//诗词内容
							listyy:JSON.stringify(da.listyy),//诗词相关语音
							bstate:bstate,
						};
						this.insert_scyy(params);
				    },
					onCancel: () => {
						const params={
							pname:da.pname, 
							author:da.author, 
							nj:da.nj, 
							bj:da.bj, 
							pcontent:da.pcontent, 
							fm:da.fm, 
							listsc:JSON.stringify(da.listsc),//诗词内容
							listyy:JSON.stringify(da.listyy),//诗词相关语音
							bstate:bstate,
						};
						this.insert_scyy(params);
					}
				});
				
                
	        },
			
			insert_scyy(params){
				this.$http.post("/host/readbook/scyy/insert_scyy.html",params)
				.then(result => {
					if(result){
						this.$Modal.success({
				            title: "提示",
				            content: "添加成功！"
				       });
				       this.$emit("reload");
				       this.$refs.Tcontent.closeModal();
					}else{
						this.$Modal.error({
				            title: "提示",
				            content: "添加失败，请联系管理员！"
				        });	
					}
				});
			},
			
			openmodal(){
				this.$refs.Tcontent.modal0 = true;
			}
		},
		mounted() {

		},
		watch:{
			
		}
	}
</script>

<style scoped="scoped">
	
</style>



